package com.template;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.List;

import com.template.utils.TStringUtils;

public class TDao {

	public static void createXMLFile(String tableName, String packageName,List<TableBean>columnList,List<TableBean>priList, List<TableBean>noPriList, String folderName, String path) {
		String className = TStringUtils.tableName2ClassName(tableName);
	    String attrName = TStringUtils.columnName2Attr(tableName);
	    String str = "";
	    str +="package "+packageName+".dao;\r\n";
	    str +="import java.util.List;\r\n";
	    str +="import "+packageName+".util.ParameterMap;\r\n\r\n";
        str +=" public interface "+className+"Dao {\r\n";
	    str +="     public List<ParameterMap> list();\r\n";
	    str +="     public void edit"+className+"(ParameterMap pm);\r\n";
	    str +="     public void add"+className+"(ParameterMap pm);\r\n";
	    str +="     public void del"+className+"(long id);\r\n";
	    str +="   }\r\n";

	    
		try {
			String allPath = path+"\\"+className+"Dao.java";
			OutputStreamWriter output = new OutputStreamWriter(new FileOutputStream(allPath),"UTF-8");
			output.write(str);
			output.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
